﻿using NazTek.Documenter.Ssis.Control.Tasks;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Tasks.SendMailTask;
using Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask;

namespace NazTek.Documenter.Ssis.Control
{
    internal class SsisTaskBuilder
    {
        internal static ISsisTask BuildTask(TaskHost task, SsisPackage package)
        {
            var component = task.InnerObject;
            if (component is IDTSPipeline100)
                return new SsisPipe(task, package);
            if (component is ExecuteSQLTask)
                return new SsisSql(task);
            if (component is SendMailTask)
                return new SsisMail(task);
            return new SsisUnsupportedTask(task.Name);
        }
    }
}